package com.sanpu.kxe.business.member.adapter;

import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sanpu.kxe.R;
import com.sanpu.kxe.business.member.bean.MemberPromotOutput;
import com.sanpu.kxe.common.interfaces.CommonConfig;

import java.util.ArrayList;

/**
 * Description：会员推广列表
 * Created by 薛勇军 on 2019/4/15.
 */

public class MemberPromotAdapter extends BaseQuickAdapter<MemberPromotOutput, BaseViewHolder> {

    public MemberPromotAdapter() {
        super(R.layout.item_member_promot, new ArrayList<MemberPromotOutput>());
    }

    @Override
    protected void convert(BaseViewHolder helper, MemberPromotOutput item) {
        if (item != null) {
            helper.setText(R.id.phoneNumberTv, !TextUtils.isEmpty(item.getPhoneNumber()) ? item.getPhoneNumber() : "")
                    .setText(R.id.gradeTv, "（" + item.getLevelName() + "）")
                    .setText(R.id.registerTimeTv, !TextUtils.isEmpty(item.getRegisterTime()) ? item.getRegisterTime() : "")
                    .addOnClickListener(R.id.callTelLl);

            TextView realNameTv = helper.getView(R.id.realNameTv);
            if (TextUtils.equals(CommonConfig.AUTHEN_PASS, item.getChkSts())) {
                if (!TextUtils.isEmpty(item.getRealName())) {
                    realNameTv.setText(item.getRealName());
                    realNameTv.setTextColor(ContextCompat.getColor(mContext, R.color.c_efcb72));
                }
            } else {
                realNameTv.setText("未实名");
                realNameTv.setTextColor(ContextCompat.getColor(mContext, R.color.black));
            }
        }
    }
}
